package o;

import android.content.Context;
import com.huawei.appgallery.forum.option.comment.bean.UpdateCommentRes;
import o.brc.e;
import o.byk.d;

public class byi {
    private Context ˋ;
    private String ˎ;
    private byg ˏ;

    public byi(String str, byg o_byg, Context context) {
        this.ˎ = str;
        this.ˏ = o_byg;
        this.ˋ = context;
    }

    public fjo<bye> ॱ() {
        fjx o_fjx = new fjx();
        if (doo.ˊ(this.ˋ)) {
            ˊ(o_fjx);
        } else {
            evk.ˏ(this.ˋ.getString(bse.ˏ.ˏ()));
            ˎ(4, o_fjx);
        }
        return o_fjx.ॱ();
    }

    private void ˊ(final fjx<bye> o_fjx_o_bye) {
        ((cbh) fho.ˏ().ˋ("User").ॱ(cbh.class)).ˎ(this.ˋ, 15).ˏ(new fjq<Boolean>(this) {
            final /* synthetic */ byi ˏ;

            public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
                if (!o_fjo_java_lang_Boolean.ˊ()) {
                    return;
                }
                if (((Boolean) o_fjo_java_lang_Boolean.ॱ()).booleanValue()) {
                    this.ˏ.ˋ(o_fjx_o_bye);
                } else {
                    this.ˏ.ˎ(1, o_fjx_o_bye);
                }
            }
        });
    }

    private void ˋ(fjx<bye> o_fjx_o_bye) {
        if (this.ˏ == null) {
            ˎ(3, o_fjx_o_bye);
        } else if (this.ˏ.ॱ() == null || this.ˏ.ॱ().ॱॱ() == 2) {
            ॱ((fjx) o_fjx_o_bye);
        } else {
            ˎ(3, o_fjx_o_bye);
        }
    }

    private void ॱ(final fjx<bye> o_fjx_o_bye) {
        ((brc) fho.ˏ().ˋ("Base").ॱ(brc.class)).ˋ(new d(this.ˏ, false).ॱ(this.ˎ).ˊ(), new e<byk, UpdateCommentRes>(this) {
            final /* synthetic */ byi ˏ;

            public /* synthetic */ void ˋ(Object obj, Object obj2) {
                ˏ((byk) obj, (UpdateCommentRes) obj2);
            }

            public /* synthetic */ void ˏ(Object obj, Object obj2) {
                ˋ((byk) obj, (UpdateCommentRes) obj2);
            }

            public void ˋ(byk o_byk, UpdateCommentRes updateCommentRes) {
            }

            public void ˏ(byk o_byk, UpdateCommentRes updateCommentRes) {
                if (updateCommentRes.getResponseCode() == 0 && updateCommentRes.getRtnCode_() == 0) {
                    this.ˏ.ˏ.ॱ(updateCommentRes.ˋ());
                    byz.ˋ(false, String.valueOf(this.ˏ.ˏ.ˋ()));
                    brd.ॱ.ˏ(bqy.ˋ().ˎ(this.ˏ.ˋ), this.ˏ.ˎ, String.valueOf(this.ˏ.ˏ.ˎ()), String.valueOf(this.ˏ.ˏ.ˋ()));
                    this.ˏ.ˎ(0, o_fjx_o_bye);
                } else if (updateCommentRes.getRtnCode_() == 3004) {
                    evk.ˏ(this.ˏ.ˋ.getString(bse.ˏ.ˏ("comment", 3004)));
                    this.ˏ.ˎ(2, o_fjx_o_bye);
                } else {
                    evk.ˏ(this.ˏ.ˋ.getString(bse.ˏ.ॱ(updateCommentRes.getRtnCode_()).ˏ()));
                    this.ˏ.ˎ(2, o_fjx_o_bye);
                }
            }
        });
    }

    private void ˎ(int i, fjx<bye> o_fjx_o_bye) {
        if (o_fjx_o_bye == null) {
            bqx.ॱ("CommentTask", "TaskCompletionSource == null");
        } else {
            o_fjx_o_bye.ॱ(new bye(this.ˏ, i));
        }
    }
}
